<template>
  <div>
    <div class="nosongs" v-if="sequencePlayList.length == 0">
      <span>暂无音乐</span>
    </div>
    <template  v-else>
    <div
     
      class="music_box"
      v-for="(item, index) in sequencePlayList"
      :key="index.id"
      @click="playMusic(index)"
    >
      <div class="index">{{ index + 1 }}</div>
      <div class="text van-ellipsis">
        <p class="van-ellipsis">{{ item.name }}</p>
        <p class="van-ellipsis">
          <span style="red" class="tagColor" v-if="item.fee == 1 || item.fee == 4"
            >版权
          </span>
          <span class="tagColor" v-else>SQ </span>
          <span>{{ item.ar }}</span>
          -
          <span>{{ item.al }}</span>
        </p>
      </div>
      <div class="slice">
        <span class="iconfont" v-show="index === currentIndex">&#xe696;</span>
      </div>
    </div>
    </template>
  </div>
</template>
<script>
import { mapGetters } from "vuex";
export default {
  name: "MusicMusicList",

  data() {
    return {};
  },

  mounted() {},
  computed: {
    ...mapGetters(["currentIndex", "sequencePlayList"]),
  },
  methods: {
    playMusic(index) {
      this.$store.commit({
        type: "SET_PLAY_MUSICINDEX",
        index: index,
      });
    },
  },
};
</script>

<style lang="less" scoped>
.music_box {
  display: flex;
  margin: 0.625rem 0rem;
  &:target { background:hsla(93,96%,62%,1.00); }
  .index {
    width: 1.875rem;
    height: 3.125rem;
    line-height: 3.125rem;
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
    color: #555;
  }
  .text {
    flex: 1;
    display: flex;
    flex-direction: column;
    p {
      height: 1.5625rem;
      line-height: 1.5625rem;
      text-align: left;
      padding-left: 0.3125rem;
      font-size: 1rem;
      color: #333;
    }
    p:nth-child(2) {
      color: #a0a0a0;
      font-size: 0.75rem;
      .tagColor {
        color: #11bf72;
      }
    }
  }
  .slice {
    width: 3.125rem;
    height: 3.125rem;
    line-height: 3.125rem;
    .iconfont {
      font-size: 1.25rem;
      color: #fb5430;
    }
  }
}
.nosongs{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
}
</style>